import { Injectable } from '@angular/core';
import { CanActivate, Router } from '@angular/router';
import { LocalStorageService } from '../../service/localStorageService/local-storage.service';


// 验证用户权重
@Injectable({
  providedIn: 'root'
})
export class CheckoutRoleGuard implements CanActivate {
  constructor(
    private router: Router,
    public localStorage: LocalStorageService,
  ) { }
  canActivate() {
    // var token: any = this.localStorage.getItem("token");
    // console.log("验证权重");

    // if (token === null) {
    //   this.router.navigate(['/login']);
    //   return;
    // }
    // else if (token.role === 'administrator') {
    //   return true;
    // } else if (token.role === 'root') {
    //   return true;
    // } else if (token.role === 'general') {
    //   this.router.navigate(['/home/error']);
    // } else {
    //   this.router.navigate(['/login']);
    // }
    return true;
  }
}
